package pattern16;

/**
 * p200
 * 迭代器模式
 * @author wdl
 */
public class IteratorPattern {
    public static void main(String[] args) {
        ConcreteAggregate concreteAggregate=new ConcreteAggregate();
        concreteAggregate.add("大鸟");
        concreteAggregate.add("小菜");
        concreteAggregate.add("行李");
        concreteAggregate.add("老外");
        concreteAggregate.add("公交内部员工");
        concreteAggregate.add("小偷");

        IIterator iterator=new ConcreteIterator(concreteAggregate);
        while (!iterator.isDone()){
            System.out.println(iterator.currentItem()+",请买车票");
            iterator.next();
        }
    }
}
